#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    ui->lcdNumber->display(10);
    timeId = this->startTimer(1000);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::timerEvent(QTimerEvent *event)
{
    if(event->timerId() != timeId)
    {
        return;
    }
    int val = ui->lcdNumber->value();
    if(val <= 0)
    {
        return;
    }
    val -= 1;
    ui->lcdNumber->display(val);
}
